<?php require ("utils.php");
//=====================================================language=============================================
if($_SESSION['langname']=="")
{
	$language_url="languages/"."english".'/checkout_final_add_language.php';
}
else
{
	$language_url="languages/".$_SESSION['langname'].'/checkout_final_add_language.php';
}

include_once("$language_url");
//======================================================End============================================

if($_SESSION['siteuserId']=="")
{
	header("location:start.php");
}

$value	=	$_REQUEST['mode'];
switch($_REQUEST['mode'])
{
	case	thank_you:		thank_you();
							break;																								
			default:		main_content("frmCheckOutFinal();");
}

function frmCheckOutFinal()
{
	//echo "select * from tblordertemp where session_id='".session_id()."'";

 $sql_fetch_temp		=	mysql_query("select * from tblordertemp where session_id='".session_id()."'");
	$cnt_temp			=	mysql_num_rows($sql_fetch_temp);
	$rec_total			=	mysql_fetch_array(mysql_query("select sum(total_amount) as TOTAL from tblordertemp where session_id='".session_id()."'"));					 
	
	// echo "select * from payment_method where userId='".$_SESSION[siteuserId]."'";
		$rowBillingDetails=mysql_fetch_array(mysql_query("select * from payment_method where userId='".$_SESSION[siteuserId]."'"));
	 
?><script language="javascript">
	function SubmitForm()
	{
		if(document.frmCheckOutFinal.payment_method.value.search(/\S/)==-1)
		{
			//alert("Please Select Payment Method");
			document.getElementById('text_val').innerHTML="<?php echo SELECT_PAYMENT_METHOD; ?>";
			document.frmCheckOutFinal.payment_method.focus();
			return false;
		}
		if(document.frmCheckOutFinal.card_type.value.search(/\S/)==-1)
		{
			//alert("Please Select Card Type");
			document.getElementById('text_val').innerHTML="<?php echo SELECT_CARD_TYPE; ?>";
			document.frmCheckOutFinal.card_type.focus();
			return false;
		}
		if(document.frmCheckOutFinal.card_no.value.search(/\S/)==-1)
		{
			//alert("Please Enter Card No");
			document.getElementById('text_val').innerHTML="<?php echo ENETER_CARD_NO; ?>";
			document.frmCheckOutFinal.card_no.focus();
			return false;
		}
	
		if(document.frmCheckOutFinal.ceMonth.value.search(/\S/)==-1)
		{
			//alert("Please Select Expire Month");
			document.getElementById('text_val').innerHTML="<?php echo SELECT_EXPIRE_MONTH; ?>";
			document.frmCheckOutFinal.ceMonth.focus();
			return false;
		}
		if(document.frmCheckOutFinal.ceYear.value.search(/\S/)==-1)
		{
			//alert("Please Select Expire Year");
			document.getElementById('text_val').innerHTML="<?php echo SELECT_EXPIRE_YEAR; ?>";
			document.frmCheckOutFinal.ceYear.focus();
			return false;
		}
// 		if(document.frmCheckOutFinal.card_type.value=="American Express")
// 		{
// 			if((document.frmCheckOutFinal.cvv_no.value.length)<4 || (document.frmCheckOutFinal.cvv_no.value.length)>4)
// 			{
// 				//alert("Please Enter Correct CVV No For "+document.frmCheckOutFinal.card_type.value);
// 				document.getElementById('text_val').innerHTML="<?php // echo ENTER_CVV_NO; ?> "+document.frmCheckOutFinal.card_type.value;
// 				document.frmCheckOutFinal.cvv_no.focus();
// 				return false;
// 			}
// 		}
// 		else
// 		{
// 			if((document.frmCheckOutFinal.cvv_no.value.length)<3 || (document.frmCheckOutFinal.cvv_no.value.length)>=4)
// 			{
// 				//alert("Please Enter Correct CVV No For "+document.frmCheckOutFinal.card_type.value);
// 				document.getElementById('text_val').innerHTML="<?php// echo ENTER_CVV_NO; ?> "+document.frmCheckOutFinal.card_type.value;
// 				document.frmCheckOutFinal.cvv_no.focus();
// 				return false;
// 			}
// 		}
		document.frmCheckOutFinal.mode.value="thank_you";
		document.frmCheckOutFinal.submit();
	}
</script>


<table width="90%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td valign="top" align="center"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="20%" valign="top"><?php include("left_pannel.php"); ?></td>
                    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td width="11"><img src="images/PinkBorderTopLeft.jpg" alt="" width="11" height="11"></td>
                              <td class="PinkBoxTopBg"><img src="images/spacer.gif" alt="" width="10" height="11"></td>
                              <td width="11"><img src="images/PinkBorderTopRight.jpg" alt="" width="11" height="11"></td>
                            </tr>
                        </table></td>
                      </tr>
                      <tr>
                        <td class="PinkTwosideBorder" valign="top">
<!--<form name="frmCheckOutFinal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">-->
<form name="frmCheckOutFinal" action="" method="post">
<input type="hidden" name="mode" id="mode" >
<input type="hidden" name="mode_paypal" id="mode_paypal" value="1">
<!--<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="karmicksol6@gmail.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="http://www.esolz.org/admobweb_new/thankYou.php?msg=paymentSuccess">
<input type="hidden" name="cancel_return" value="http://www.esolz.org/admobweb_new/failure.php">
<input type="hidden" name="notify_url" value="http://www.esolz.org/admobweb_new/thankYou.php">-->

<table width="100%" border="0" cellspacing="0" cellpadding="0">
	  <tr>
		<td align="left">&nbsp;</td>
	  </tr>
	  <tr>
		<td align="left">&nbsp;</td>
	  </tr>
	<tr>
	<td style="padding-top:20px; padding-bottom:20px;"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
	  <tr>
	  		<td>
				<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
          <tr>
            <td width="5" height="99">&nbsp;</td>
            <td width="589" valign="top" style="padding-top:2px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td><input class="buttonbg" type="button" name="continue_shopping" value="<?php echo CHECK_FINAL_CONTINUE_SHOPPING; ?>" onClick="javascript:document.location='buy_spaceNew.php?tab=buy_ads&subMenu=1'">&nbsp;<input class="buttonbg" type="button" name="edit_shopping_cart" value="<?php echo CHECK_FINAL_EDIT_SHOPPINGCART; ?>" onClick="javascript:document.location='cart.php?tab=buy_ads&subMenu=1'">&nbsp;<input class="buttonbg" type="button" name="change_address" value="<?php echo CHECK_FINAL_CHANGE_ADDRESS; ?>" onClick="javascript:document.location='checkout.php?tab=buy_ads&subMenu=1'"></td>
				<tr>
				<tr>
					<td>&nbsp;</td>
				<tr>
				<tr>
					<td>

					<table align=center width="100%" border="1" cellspacing="0" cellpadding="5" class="tblBorder">
<tr><TD>
<table align=center width="100%" border="0" cellspacing="1" cellpadding="5" class="login_txt">
						<tr class="listHeader" style="padding-left:10px;" bgcolor="#282A27">
							<td class="listHeader" align="center"><?php echo CHECK_FINAL_ADD_TITLE; ?></td>
							
							<td class="listHeader" align="center"><?php echo CHECK_FINAL_UNIT_PRICE; ?></td>
							<td class="listHeader" align="center"><?php echo CHECK_FINAL_QUANTITY; ?></td>
							<td class="listHeader" align="center"><?php echo CHECK_FINAL_PRICE; ?></td>
						</tr>
						  <?php if($cnt_temp<=0)
						  {
						  ?>
						  <tr>
							<td style="padding-left:300px;" class="ERRRED" valign="middle" colspan="5"><?php echo YOUR_CART_EMPTY; ?></td>
						  </tr>
						  <?php }
						  else
						  {
							  $i=1;
							$loop=0;
							  while($rec_fetch_temp	=	mysql_fetch_array($sql_fetch_temp))
							  {
								$rec_add	=	mysql_fetch_array(mysql_query("select * from advertise_master AM, advertise_details AD where AD.advertiseId = AM.advertiseId and AM.advertiseId='".$rec_fetch_temp['advertiseId']."' "));

								$loop++;
								if($loop%2 == 0) 
								{
								$class1="normalActive2";
								$class2="normal2";
								$class3="normal2";
								$class4="gray_sitename2";
								}
								else 
								{
								$class1="normalActive";
								$class2="normal";
								$class3="normal";
								$class4="white_sitename2";
								}

						  ?>
						<tr onmouseover="this.className='<?php echo $class1;?>'" onmouseout="this.className='<?php echo $class2;?>'" class="<?php echo $class3;?>">
							<td class="<?php echo $class4;?>" align="center">
							<?php echo stripslashes($rec_add['adTitle'])?>
							</td>
						
							<td align="center" class="<?php echo $class4;?>">
							$<?php echo stripslashes($rec_fetch_temp['adspace_price'])?></td>
							
							<td align="center" class="<?php echo $class4;?>">
							<?php echo stripslashes($rec_fetch_temp['Quentity'])?>
							</td>
							<td align="center" class="<?php echo $class4;?>">$
							<?php echo stripslashes($rec_fetch_temp['total_amount'])?>
							</td>
						</tr>
						<?php $i++;
							}
$total_item=$i-1;
						?>
						<tr>
							<td colspan="3"  style="padding-left:400px;" class="ERRRED"><?php echo CHECK_FINAL_SUBTOTAL; ?> &nbsp;</td>
							<td class="ERRRED" align="center">$<?php echo $rec_total['TOTAL']?></td>
						</tr>

<!-- ###########################################paypel form fields start############# -->
<!--<form name="checkout_confirmation" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="<?php //echo $detais['title'];?>">
<input type="hidden" name="business" value="karmicksol6@gmail.com">
<input type="hidden" name="amount" value="<?php //echo $detais['set_price'];?>">

<input type="hidden" name="currency_code" value="USD">

<input type="hidden" name="custom" value="<?php //echo $_REQUEST['id'].",".$docuent_mirror_defult['mirrorId']; ?>" />

<input type="hidden" name="custom1" value="">

<input type="hidden" name="return" value="http://www.esolzdemos.com/filehosting/success.php">
<input type="hidden" name="cancel_return" value="http://www.esolzdemos.com/filehosting/failure.php">

<input type="hidden" name="notify_url" value="http://www.esolzdemos.com/filehosting/success.php">-->

<!-- ###########################################paypel form fields ends############# -->
<input type="hidden" name="amount" id="amount" value="<?php echo $rec_total['TOTAL']; ?>">
<input type="hidden" name="item_number" value="<?php echo $total_item;?>">
<!--<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">-->

						<?php } 
						?>
					</table>
</TD></tr>
</table></td>
				</tr>
			 
				<tr>
					<td>&nbsp;</td>
				<tr>
                <tr>
                  <td valign="top" class="tblBorder"><table width="100%" border="0" cellspacing="0" cellpadding="5">
					  
                      <tr>
                        <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                          <tr>
                            <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td valign="top">&nbsp;</td>
                              </tr>
                            </table></td>
                          </tr>
                        </table></td>
                      </tr>
                      <tr>
                        <td valign="top" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td width="49%" valign="top"><table width="100%" border="1" cellspacing="0" cellpadding="0">
                                  <tr>
                                    <td width="100%" class="boderbox"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="login_txt">
                                        <tr>
                                          <td width="100%" background="images/top-header1.gif" class="topheader"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                              <tr>
                                                <td height="32" class="listHeader"  bgcolor="#282A27" style="padding-left:10px;"><?php echo CHECK_FINAL_BILLING_INFORMATION; ?></td>
                                              </tr>
                                          </table></td>
                                        </tr>
                                        <tr>
                                          <td class="tblBorder"><table width="100%" border="0" cellspacing="0" cellpadding="0">
												  <tr> 
													<td width="3%">&nbsp;</td>
													<td width="35%">&nbsp;</td>
													<td width="62%">&nbsp;</td>
												  </tr>
												  <tr> 
													<td>&nbsp;</td>
													<td class="text3" nowrap><?php echo CHECK_FINAL_BILLING_FIRST_NAME; ?>: </td>
													<td height="30"><?php echo stripslashes($rowBillingDetails[billing_fname]);?></td>
												  </tr>
												  <tr> 
													<td>&nbsp;</td>
													<td class="text3"><?php echo CHECK_FINAL_BILLING_LAST_NAME; ?>: </td>
													<td height="30"><?php echo stripslashes($rowBillingDetails[billing_lname]);?></td>
												  </tr>
												  <tr> 
													<td>&nbsp;</td>
													<td class="text3"><?php echo CHECK_FINAL_BILLING_COMPANY; ?>: 
													</td>
													<td height="30"><?php echo stripslashes($rowBillingDetails[billing_company])?></td>
												  </tr>
												  <tr> 
													<td>&nbsp;</td>
													<td class="text3"><?php echo CHECK_FINAL_BILLING_ADDRESS1; ?>: 
													</td>
													<td height="30"><?php echo stripslashes($rowBillingDetails[billing_address1])?></td>
												  </tr>
												  <tr> 
													<td>&nbsp;</td>
													<td class="text3"><?php echo CHECK_FINAL_BILLING_ADDRESS2; ?>: 
													</td>
													<td height="30"><?php echo stripslashes($rowBillingDetails[billing_address2])?></td>
												  </tr>
												  <tr> 
													<td>&nbsp;</td>
													<td height="30" class="text3"><?php echo CHECK_FINAL_BILLING_CITY; ?>: 
													</td>
													<td><?php echo stripslashes($rowBillingDetails[city])?></td>
												  </tr>
													<?php $row_country = mysql_fetch_array(mysql_query("SELECT countryName  FROM country  WHERE countryId = '".$rowBillingDetails[countryId]."'"));
													?>
												  <tr> 
													<td>&nbsp;</td>
													<td class="text3"><?php echo CHECK_FINAL_BILLING_COUNTRY; ?>:</td>
													<td height="35"><?php echo stripslashes($row_country[countryName])?></td>
												  </tr>
													<?php $row_state = mysql_fetch_array(mysql_query("SELECT state_name  FROM state WHERE stateId = '".$rowBillingDetails[stateId]."'"));
													?>
												  <tr> 
													<td>&nbsp;</td>
													<td class="text3"><?php echo CHECK_FINAL_BILLING_STATE; ?>:</td>
													<td height="30"><?php echo stripslashes($row_state[state_name])?></td>
												  </tr>
												  <tr> 
													<td>&nbsp;</td>
													<td class="text3"><?php echo CHECK_FINAL_BILLING_ZIP; ?>: </td>
													<td height="30"><?php echo stripslashes($rowBillingDetails[zip])?></td>
												  </tr>
												  <tr> 
													<td>&nbsp;</td>
													<td class="text3"><?php echo CHECK_FINAL_BILLING_PHONE; ?>: 
													</td>
													<td height="30"><?php echo stripslashes($rowBillingDetails[billing_phone])?></td>
												  </tr>
												  <tr> 
													<td>&nbsp;</td>
													<td class="text3"><?php echo CHECK_FINAL_BILLING_FAX; ?>:</td>
													<td height="30"><?php echo stripslashes($rowBillingDetails[billing_fax])?></td>
												  </tr>
												  <tr> 
													<td>&nbsp;</td>
													<td class="text3" nowrap><?php echo CHECK_FINAL_BILLING_EMAIL_ADDRESS; ?>: </td>
													<td height="30"><?php echo stripslashes($rowBillingDetails[billing_email])?></td>
												  </tr>
												  <tr> 
													<td>&nbsp;</td>
													<td class="text3">&nbsp;</td>
													<td height="30" class="linktext style1">&nbsp;</td>
												  </tr>
												  <tr> 
													<td>&nbsp;</td>
													<td class="text3">&nbsp;</td>
													<td height="30" class="linktext">&nbsp;</td>
												  </tr>
												</table></td>
                                        </tr>
                                    </table></td>
                                  </tr>
                                  <!--<tr>
                                    <td>&nbsp;</td>
                                  </tr>-->
                                </table></td>
                                <td>&nbsp;</td>
                                <td valign="top"><table width="100%" border="1" cellspacing="0" cellpadding="0" class="login_txt">
                                  <tr>
                                    <td width="100%" class="boderbox"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                          <td width="100%" background="images/top-header1.gif" class="topheader"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                              <tr>
                                                <td height="32" class="listHeader"  bgcolor="#282A27" style="padding-left:10px;"><?php echo CHECK_FINAL_SHIPPING_INFORMATION; ?></td>
                                              </tr>
                                          </table></td>
                                        </tr>
                                        <tr>
                                          <td valign="top" class="tblBorder"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                          <tr> 
                                                            <td width="3%">&nbsp;</td>
                                                            <td width="35%">&nbsp;</td>
                                                            <td width="62%">&nbsp;</td>
                                                          </tr>
                                                          <tr> 
                                                            <td>&nbsp;</td>
                                                            <td class="text3" nowrap><?php echo CHECK_FINAL_SHIPPING_FIRST_NAME; ?>: </td>
                                                            <td height="30"><?php echo stripslashes($rowBillingDetails[shipping_fname])?></td>
                                                          </tr>
                                                          <tr> 
                                                            <td>&nbsp;</td>
                                                            <td class="text3" nowrap><?php echo CHECK_FINAL_SHIPPING_LAST_NAME; ?>: </td>
                                                            <td height="30"><?php echo stripslashes($rowBillingDetails[shipping_lname])?></td>
                                                          </tr>
                                                          <tr> 
                                                            <td>&nbsp;</td>
                                                            <td class="text3"><?php echo CHECK_FINAL_SHIPPING_COMPANY; ?>: 
                                                            </td>
                                                            <td height="30"><?php echo stripslashes($rowBillingDetails[shipping_company])?></td>
                                                          </tr>
                                                          <tr> 
                                                            <td>&nbsp;</td>
                                                            <td class="text3"><?php echo CHECK_FINAL_SHIPPING_ADDRESS1; ?>: 
                                                            </td>
                                                            <td height="30"><?php echo stripslashes($rowBillingDetails[shipping_address1])?></td>
                                                          </tr>
                                                          <tr> 
                                                            <td>&nbsp;</td>
                                                            <td class="text3"><?php echo CHECK_FINAL_SHIPPING_ADDRESS2; ?>: 
                                                            </td>
                                                            <td height="30"><?php echo stripslashes($rowBillingDetails[shipping_address2])?></td>
                                                          </tr>
                                                          <tr> 
                                                            <td>&nbsp;</td>
                                                            <td height="30" class="text3"><?php echo CHECK_FINAL_SHIPPING_CITY; ?>: 
                                                            </td>
                                                            <td><?php echo stripslashes($rowBillingDetails[shipping_city])?></td>
                                                          </tr>
															<?php $row_country = mysql_fetch_array(mysql_query("SELECT *  FROM country  WHERE countryId = '".$rowBillingDetails[shipping_country]."'"));
															?>
                                                          <tr> 
                                                            <td>&nbsp;</td>
                                                            <td class="text3"><?php echo CHECK_FINAL_SHIPPING_COUNTRY; ?>:</td>
                                                            <td height="35"><?php echo stripslashes($row_country[countryName]);?></td>
                                                          </tr>
															<?php $row_state = mysql_fetch_array(mysql_query("SELECT state_name  FROM state  WHERE stateId = '".$rowBillingDetails[shipping_state]."'"));
															?>
                                                          <tr> 
                                                            <td>&nbsp;</td>
                                                            <td class="text3"><?php echo CHECK_FINAL_SHIPPING_STATE; ?>:</td>
                                                            <td height="30"><?php echo stripslashes($row_state[state_name])?></td>
                                                          </tr>
                                                          <tr> 
                                                            <td>&nbsp;</td>
                                                            <td class="text3"><?php echo CHECK_FINAL_SHIPPING_ZIP; ?>: </td>
                                                            <td height="30"><?php echo stripslashes($rowBillingDetails[shipping_zip])?></td>
                                                          </tr>
                                                          <tr> 
                                                            <td>&nbsp;</td>
                                                            <td class="text3"><?php echo CHECK_FINAL_SHIPPING_PHONE; ?>: 
                                                            </td>
                                                            <td height="30"><?php echo stripslashes($rowBillingDetails[shipping_phone])?></td>
                                                          </tr>
                                                          <tr> 

                                                            <td>&nbsp;</td>
                                                            <td class="text3"><?php echo CHECK_FINAL_SHIPPING_FAX; ?>:</td>
                                                            <td height="30"><?php echo stripslashes($rowBillingDetails[shipping_fax])?></td>
                                                          </tr>
                                                          <tr> 
                                                            <td>&nbsp;</td>
                                                            <td class="text3" nowrap><?php echo CHECK_FINAL_SHIPPING_EMAIL_ADDRESS; ?>: </td>
                                                            <td height="30"><?php echo stripslashes($rowBillingDetails[shipping_email])?></td>
                                                          </tr>
                                                          <tr> 
                                                            <td>&nbsp;</td>
                                                            <td class="text3">&nbsp;</td>
                                                            <td height="30" class="linktext style1">&nbsp;</td>
                                                          </tr>
                                                          <tr> 
                                                            <td>&nbsp;</td>
                                                            <td class="text3">&nbsp;</td>
                                                            <td height="30" class="linktext">&nbsp;</td>
                                                          </tr>
                                                        </table></td>
                                        </tr>
                                    </table></td>
                                  </tr>
                                </table></td>
                              </tr>
                            </table></td>
                      </tr>
                      
                  </table></td>
                </tr>
				<tr>
					<td>&nbsp;</td>
				<tr>
				<tr>
					<td  align="right" style="padding-left:300px;padding-bottom:5px;"><span style="font-size:12px;"><font color="#FF0000"><?php echo ALL_MARKED_FIELD; ?></font> </span></td>
				</tr>
				<tr>
					<td>
					<table align="center" width="100%" border="1" cellspacing="0" cellpadding="5" class="tblBorder">
<tr><TD>
<table align="center" width="100%" border="0" cellspacing="0" cellpadding="5" class="login_txt">
						  <tr>
							<td  align="left" colspan="3" class="listHeader" style=" padding-left:10px;"><?php echo PAYMENT_INFORMATION; ?></td>
						  </tr>

							<tr>
							<td  align="left" colspan="3">&nbsp;</td>
						  </tr>

						 <tr>
							<td  align="center" colspan="3" class="ERR"><font id="text_val"></font></td>
						  </tr>

						<tr>
							<td  align="left" colspan="3">&nbsp;</td>
						  </tr>
						<tr>
							<td class="text3" style="padding-bottom:5px;"><?php echo PAYMENT_METHOD; ?><font color="#FF0000">* </font></td>
							<td style="padding-bottom:5px;">:</td>
							<td style="padding-bottom:5px;" align="left"><select name="payment_method" id="select4" class="InputBox" style="width:150px;">
								<option value="">Select One</option>
								<option value="Credit Card">Credit Card</option>
								</select>
							</td>
						</tr>
						<tr valign=top>
							<td nowrap="nowrap" class="text3" style="padding-bottom:5px;"><?php echo CREDIT_DEBIT_CARD_TYPE; ?><font color="#FF0000">*</font></td>
							<td style="padding-bottom:5px;">:</td>
							<td align="left" style="padding-bottom:5px;"><select name="card_type" class="InputBox" style="width:150px;" id="select5">
							<option value="" selected>Select one</option>
							<option value="Visa">Visa</option>
							<option value="American Express">American Express</option>
							<option value="Master Card">Master Card</option>
							<option value="AMEX">AMEX</option>
							<option value="Discovery">Discovery</option>
							</select></td>
						</tr>
						<tr>
							<td class="text3" style="padding-bottom:5px;"><?php echo CREDIT_CARD_NO; ?><font color="#FF0000">*</font>:</td>
							<td style="padding-bottom:5px;">:</td>
							<td align="left" style="padding-bottom:5px;"><input name="card_no" type="text" class="InputBox" style="width:150px;" id="textfield12" /></td>
						</tr>
						<tr>
							<td class="text3" style="padding-bottom:5px;"><?php echo EXPIRE_DATE; ?><font color="#FF0000">*</font></td>
							<td style="padding-bottom:5px;">:</td>
							<td align="left" style="padding-bottom:5px;"><select name="ceMonth" class="InputBox" style="width:150px;" id="select6">
							<option value="">Select Month</option>					
							<option value="01">January</option>					
							<option value="02">February</option>					
							<option value="03">March</option>					
							<option value="04">April</option>					
							<option value="05">May</option>					
							<option value="06">June</option>					
							<option value="07">July</option>					
							<option value="08">August</option>					
							<option value="09">September</option>					
							<option value="10">October</option>					
							<option value="11">November</option>					
							<option value="12">December</option>
							</select>&nbsp;
							<select name="ceYear" id="select7" class="InputBox" style="width:150px;">
								<option value="">Select Year</option>				
								<option value="2009">2009</option>					
								<option value="2010">2010</option>					
								<option value="2011">2011</option>					
								<option value="2012">2012</option>					
								<option value="2013">2013</option>
								<option value="2014">2014</option>
								<option value="2015">2015</option>
								</select>
							</td>
							
						</tr>
						<tr>
							<td class="text3" style="padding-bottom:5px;"><?php echo CVV_NO; ?><font color="#FF0000">*</font></td>
							<td style="padding-bottom:5px;">:</td>
							<td style="padding-bottom:5px;" align="left"><input name="cvv_no" type="text" class="InputBox" style="width:150px;" id="cvv_no"/>&nbsp;(Required for Visa, MasterCard, American Express,AMEX &amp; Discover)</td>
						</tr>
						<tr>
						<td colspan="2" style="padding-top:10px;padding-bottom:15px;">&nbsp;</td>
					<td align="left" style="padding-top:10px;padding-bottom:15px;"><input class="buttonbg" type="submit" name="checkout" value="Place Order" onClick="javascript:return SubmitForm();"></td>
				<tr>
					</table>
</TD></tr>
</table></td>
				</tr>
				<!--<tr>
					<td>&nbsp;</td>
				<tr>
				<tr>
					<td><input class="buttonbg" type="submit" name="checkout" value="Place Order" onClick="javascript:return SubmitForm();"></td>
				<tr>-->
            </table>
              </td>
            <td width="3">&nbsp;</td>
          </tr>
        </table></td>
	  </tr>
	</table></td>
	</tr>
</table>
</form>
</td>
                      </tr>
                      <tr>
                        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td width="11"><img src="images/PinkBorderBottomLeft.jpg" alt="" width="11" height="11"></td>
                              <td class="PinkBoxBottomBg"><img src="images/spacer.gif" alt="" width="10" height="11"></td>
                              <td width="11"><img src="images/PinkBorderBottomRight.jpg" alt="" width="11" height="11"></td>
                            </tr>
                        </table></td>
                      </tr>
                    </table>

</td>
                    <td>&nbsp;</td>
                    </tr>
                </table></td>
              </tr>
            </table>
<!--</form>-->
            
<?php }
function thank_you()
{
if($_REQUEST['mode_paypal']=='1')
{
	$x_exp_date =$_REQUEST['ceMonth'] . $_REQUEST['ceYear'];
	$rsCart=mysql_fetch_array(mysql_query($a="select sum(total_amount) from tblordertemp where session_id='".session_id()."'"));
	$total_cart_amount =$rsCart['0'];
	$row_billing = mysql_fetch_array(mysql_query("SELECT *  FROM payment_method WHERE userId = '".$_SESSION['siteuserId']."'"));
	

	$expiry_date=$_REQUEST[ceMonth]."-".$_REQUEST[ceYear];
	
	$sqlInsertOrder ="insert into tblordermaster  set paymentId='".$row_billing[paymentId]."'";
	$sqlInsertOrder .=", order_date='".date("y-m-d")."'";
	$sqlInsertOrder .=", total_amount='".$total_cart_amount."'";
	$sqlInsertOrder .=", grand_total='".$total_cart_amount."'";
	$sqlInsertOrder .=", payment_method='".$_REQUEST[payment_method]."'";
	$sqlInsertOrder .=", card_type='".$_REQUEST[card_type]."'";
	$sqlInsertOrder .=", card_no='".$_REQUEST[card_no]."'";
	$sqlInsertOrder .=", siteuserId='".$_SESSION['siteuserId']."'";
	$sqlInsertOrder .=", expire_date='".$expiry_date."'";

	if(mysql_query($sqlInsertOrder) or die(mysql_error()))//insert into order master table
	{
		
			$order_id=mysql_insert_id();
			$rsFetchCart=mysql_query("select * from tblordertemp  where session_id='".session_id()."'");
			while($rowFetchCart=mysql_fetch_array($rsFetchCart))
			{
				$rsInsertProduct=mysql_query("insert into tblorderdetail set order_id='".$order_id."',
				siteuserId='".$rowFetchCart['siteuserId']."',
				adsiteId='".$rowFetchCart[adsiteId]."',
				adspaceId='".$rowFetchCart[adspaceId]."',
				advertiseId='".$rowFetchCart[advertiseId]."',
				adspace_price='".$rowFetchCart[adspace_price]."',
				payment_reason='Buy adspace',
				payout_date=NOW(),
				type='cr',
				payment_status='Y',
				add_qty='".$rowFetchCart[Quentity]."'") or die(mysql_error());;//fetch product details from cart and insert into order product details table
				$rsUpdateProduct=mysql_query($a="update advertise_master set advertiseStatus='Y' where advertiseId='".$rowFetchCart[advertiseId]."'");
				
			}
			
		$sqlDeleteCart="delete from tblordertemp where session_id='".session_id()."'";//empty cart
			mysql_query($sqlDeleteCart);

				}
?>
<body onload="document.forms.formname.submit();">
<form name="frm_paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="karmicksol6@gmail.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="http://www.esolz.org/admob/thankYou.php?msg=paymentSuccess">
<input type="hidden" name="cancel_return" value="http://www.esolz.org/admobweb/failure.php">
<input type="hidden" name="notify_url" value="http://www.esolz.org/admobweb_new/thankYou.php">
<input type="hidden" name="amount" id="amount" value="<?php echo $_REQUEST['amount']; ?>">
<input type="hidden" name="item_number" value="<?php echo $_REQUEST['item_number'];?>">
</form>
</body>

<?php
echo "<script>document.frm_paypal.submit();</script>";
}

}
?>